package com.suprema.biomini;

import javax.swing.JPanel;
import javax.swing.SpinnerModel;
import javax.swing.SpinnerNumberModel;

/**
 *
 * @author Kent Yeh
 */
public class TempPanel extends JPanel {

    /** Creates new form TempPanel */
    public TempPanel() {
        initComponents();
    }

    public int getTempIndex() {
        SpinnerModel model = tempIndex.getModel();
        if (model instanceof SpinnerNumberModel) {
            return ((SpinnerNumberModel) model).getNumber().intValue();
        } else {
            return 0;
        }
    }

    public void setTempIndex(int tempIndex) {
        this.tempIndex.setValue(tempIndex);
    }

    public String getTempName() {
        return tempName.getText();
    }

    public void setTempName(String tempName) {
        this.tempName.setText(tempName);
    }
    public boolean isAutoExt(){
        return extMode.isSelected();
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        tempName = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        tempIndex = new javax.swing.JSpinner();
        extMode = new javax.swing.JCheckBox();

        jLabel1.setDisplayedMnemonic('m');
        jLabel1.setLabelFor(tempName);
        jLabel1.setText("名稱(m):");
        jLabel1.setToolTipText("請輸入指紋之識別名稱");

        tempName.setToolTipText("請輸入指紋之識別名稱");

        jLabel2.setDisplayedMnemonic('i');
        jLabel2.setLabelFor(tempName);
        jLabel2.setText("索引(i):");
        jLabel2.setToolTipText("請輸入指紋之索引值");

        tempIndex.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));

        extMode.setMnemonic('x');
        extMode.setSelected(true);
        extMode.setText("自動附檔名(x)");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addGroup(layout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(jLabel2)
                                .addGap(9, 9, 9)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(tempName, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(tempIndex, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(extMode)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jLabel1)
                    .addComponent(tempName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(tempIndex, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(extMode))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox extMode;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JSpinner tempIndex;
    private javax.swing.JTextField tempName;
    // End of variables declaration//GEN-END:variables
}
